package com.shuaiche.yeguan.ui.report;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;

import com.chad.library.adapter.base.BaseViewHolder;
import com.shuaiche.yeguan.R;
import com.shuaiche.yeguan.base.SCBaseQuickAdapter;
import com.shuaiche.yeguan.model.SCMaintenanceRecordResponse;
import com.shuaiche.yeguan.util.GlideUtil;
import com.shuaiche.yeguan.util.SCTimeUtils;
import com.shuaiche.yeguan.util.StringUtils;

import java.util.List;

/**
 * Created by chen on 2019/8/7.
 */

public class SCMatchingRecordsAdapter extends SCBaseQuickAdapter<SCMaintenanceRecordResponse> {

    public SCMatchingRecordsAdapter(Context context, List<SCMaintenanceRecordResponse> data) {
        super(context, R.layout.layout_mathing_record_item, data);
    }


    @Override
    protected void convert(BaseViewHolder baseViewHolder, final SCMaintenanceRecordResponse scMaintenanceGoodsResponse) {
        String time = SCTimeUtils.showTime(scMaintenanceGoodsResponse.getCreateTime());
        String merchantName = scMaintenanceGoodsResponse.getMerchantName();
        String name="-";
        if (!StringUtils.isEmpty(merchantName)){
            name = merchantName.substring(merchantName.indexOf("(")+1, merchantName.indexOf(")"))+"分享了维保记录"; //截取括号里的简称
        }
        baseViewHolder.setText(R.id.tv_share_name, name);
        baseViewHolder.setText(R.id.tv_date, time);
        GlideUtil.loadRoundImg(mContext, scMaintenanceGoodsResponse.getMerchantLogoPic(),
                (ImageView) baseViewHolder.getView(R.id.img_logo),
                R.mipmap.pic_default_company_logo_round);

    }


}
